<template>
    <div class="member">
        <view-head></view-head>
        <div class="m-content">
            <div class="m-c-left">
                <el-menu :router="true" :default-openeds=defaultOpened >
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span slot="title">账号安全</span>
                        </template>
                        <el-menu-item index="/member/me">手机/邮箱</el-menu-item>
                        <el-menu-item index="/member/google">谷歌验证码</el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span slot="title">我的资产</span>
                        </template>
                        <el-menu-item index="/member/wallet">钱包资产</el-menu-item>
                        <el-menu-item index="/member/assets">平台资产</el-menu-item>
                    </el-submenu>
                </el-menu>
            </div>
            <div class="m-c-right">
                <router-view></router-view>
            </div>
        </div>
    </div>
</template>

<script>
    import Header from '@/components/__header.vue'
    export default {
        name: "member",
        data(){
            return {
                defaultOpened:[],//menu默认打开
            }
        },
        components: {
            'view-head':Header,
        },
        created(){
            this.$router.push({name:'my'});
            this.defaultOpened=['1','2'];
        },
        beforeUpdate(){
            if(this.$router.history.current.path=="/member"){
                this.$router.push({name:'my'});
            }
        }
    }
</script>

<style scoped lang="scss">
.m-content{
    width: 1200px; margin: 0 auto; padding-top: 80px;
    .m-c-left{
        position: fixed;width: 200px;
    }
    .m-c-right{
        padding-left: 210px;
    }
}
</style>
